#include <iostream>

using namespace std;

bool check(double wen, int flag)
{
	return wen >= 37.5 && flag;
}

int main()
{
	int n; cin >> n;
	int cnt = 0;
	while (n--)
	{
		string name; cin >> name;
		double wen; cin >> wen;
		int flag; cin >> flag;
		if (check(wen, flag))
		{
			cout << name << endl;
			cnt++;
		}
	}
	cout << cnt << endl;
	
	return 0;
}
